<%@ page import="com.zhiyou100.test.Email" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" pageEncoding="utf-8" %>
<html>
<head>
    <title>Title</title>
<script type="text/javascript" src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
<script type="text/javascript">
    function checkEmail() {
        var email=/^[A-Za-z\d]+([-_.][A-Za-z\d]+)*@([A-Za-z\d]+[-.])+[A-Za-z\d]{2,4}$/;
        var eamil1=$("#email").val();
        if(email.test(eamil1)){
            $("#s2").html("格式正确")
        }else {
            $("#s2").html("格式错误")
        }
    }
    function play() {
        var a=$("#v_Code");
        $.ajax({
            url:'${pageContext.request.contextPath}/ajaxPlay.do'
        })
    }
</script>
</head>
<body>
<form action="${pageContext.request.contextPath}/ajaxTest.do" >
    <input type="text" name="username" id="username" placeholder="请输入用户名"><br>
    <input type="password" name="password" placeholder="请输入密码"><br/>
    <input type="text" name="email" id="email" placeholder="请输入邮箱" onblur="checkEmail()" ><span id="s2"></span><br>
    <input type="text" name="v_Code" placeholder="请输入验证码" id="v_Code">
    <input type="button" value="发送验证码" onclick="play()"><span id="s3"></span><br>
    <input type="submit">
</form>
</body>
</html>
